/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/15
\**********************/
#include "LuaListHeaderItem.h"

#define CObjPtr ((CListHeaderItemUI*)m_cobj)

namespace DuiLib {

void LuaListHeaderItem::SetEnabled(bool bEnable)
{
    CObjPtr->SetEnabled(bEnable);
}

bool LuaListHeaderItem::IsDragable()
{
    return CObjPtr->IsDragable();
}

void LuaListHeaderItem::SetDragable(bool bDragable)
{
    CObjPtr->SetDragable(bDragable);
}

DWORD LuaListHeaderItem::GetSepWidth()
{
    return CObjPtr->GetSepWidth();
}

void LuaListHeaderItem::SetSepWidth(int iWidth)
{
    CObjPtr->SetSepWidth(iWidth);
}

DWORD LuaListHeaderItem::GetTextStyle()
{
    return CObjPtr->GetTextStyle();
}

void LuaListHeaderItem::SetTextStyle(UINT uStyle)
{
    CObjPtr->SetTextStyle(uStyle);
}

DWORD LuaListHeaderItem::GetTextColor()
{
    return CObjPtr->GetTextColor();
}

void LuaListHeaderItem::SetTextColor(DWORD dwTextColor)
{
    CObjPtr->SetTextColor(dwTextColor);
}

int LuaListHeaderItem::SetTextPadding(LuaState *L)
{
    LuaStack args(L);
    RECT rc = LuaHelperNS::GetRect(args[2]);
    CObjPtr->SetTextPadding(rc);
    return 0;
}

int LuaListHeaderItem::GetTextPadding(LuaState *L)
{
    RECT rc = CObjPtr->GetTextPadding();
    LuaHelperNS::PushRect(L, rc);
    return 1;
}

void LuaListHeaderItem::SetFont(int index)
{
    CObjPtr->SetFont(index);
}

bool LuaListHeaderItem::IsShowHtml()
{
    return CObjPtr->IsShowHtml();
}

void LuaListHeaderItem::SetShowHtml(bool bShowHtml)
{
    CObjPtr->SetShowHtml(bShowHtml);
}

int LuaListHeaderItem::GetNormalImage(LuaState *L)
{
    SDTString str = CObjPtr->GetNormalImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaListHeaderItem::SetNormalImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetNormalImage(str.c_str());
    return 0;
}

int LuaListHeaderItem::GetHotImage(LuaState *L)
{
    SDTString str = CObjPtr->GetHotImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaListHeaderItem::SetHotImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetHotImage(str.c_str());
    return 0;
}

int LuaListHeaderItem::GetPushedImage(LuaState *L)
{
    SDTString str = CObjPtr->GetPushedImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaListHeaderItem::SetPushedImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetForeImage(str.c_str());
    return 0;
}

int LuaListHeaderItem::GetFocusedImage(LuaState *L)
{
    SDTString str = CObjPtr->GetFocusedImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaListHeaderItem::SetFocusedImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetFocusedImage(str.c_str());
    return 0;
}

int LuaListHeaderItem::GetSepImage(LuaState *L)
{
    SDTString str = CObjPtr->GetSepImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaListHeaderItem::SetSepImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetSepImage(str.c_str());
    return 0;
}

void LuaListHeaderItem::SetScale(int nScale)
{
    CObjPtr->SetScale(nScale);
}

int LuaListHeaderItem::GetScale()
{
    return CObjPtr->GetScale();
}

int LuaListHeaderItem::EstimateSize(LuaState *L)
{
    LuaStack args(L);
    SIZE szAvailable = LuaHelperNS::GetSize(args[2]);
    SIZE sz = CObjPtr->EstimateSize(szAvailable);
    LuaHelperNS::PushSize(L, sz);
    return 1;
}

int LuaListHeaderItem::GetThumbRect(LuaState *L)
{
    RECT rc = CObjPtr->GetThumbRect();
    LuaHelperNS::PushRect(L, rc);
    return 1;
}

SDLUA_BEGIN_REGISTER(LuaListHeaderItem, ListHeaderItem, Container)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetEnabled, SetEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, IsDragable, IsDragable)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetDragable, SetDragable)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, GetSepWidth, GetSepWidth)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetSepWidth, SetSepWidth)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, GetTextStyle, GetTextStyle)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetTextStyle, SetTextStyle)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, GetTextColor, GetTextColor)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetTextColor, SetTextColor)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, SetTextPadding, SetTextPadding)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetTextPadding, GetTextPadding)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetFont, SetFont)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, IsShowHtml, IsShowHtml)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetShowHtml, SetShowHtml)

    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetNormalImage, GetNormalImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, SetNormalImage, SetNormalImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetHotImage, GetHotImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, SetHotImage, SetHotImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetPushedImage, GetPushedImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, SetPushedImage, SetPushedImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetFocusedImage, GetFocusedImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, SetFocusedImage, SetFocusedImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetSepImage, GetSepImage)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, SetSepImage, SetSepImage)
    
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, SetScale, SetScale)
    SDLUA_REGISTER_FUN_CPP(LuaListHeaderItem, GetScale, GetScale)

    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, EstimateSize, EstimateSize)
    SDLUA_REGISTER_FUN_LUA(LuaListHeaderItem, GetThumbRect, GetThumbRect)

SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaListHeaderItem, ListHeaderItem)
SDLUA_END_UNREGISTER(ListHeaderItem)

}

#undef CObjPtr